package com.hlhj.funlike_businessqzxd.moudle;

import android.content.Context;

import com.example.mymvp.mvp.BaseModule;
import com.hlhj.funlike_businessqzxd.api.Apis;
import com.hlhj.funlike_businessqzxd.api.BaseObser;
import com.hlhj.funlike_businessqzxd.bean.FoodListBean;
import com.lzy.okgo.model.Response;

import java.util.List;

public class ShowFoodListFragmentMoudle implements BaseModule {
    public interface getFoodList{
        void LoadFoodList(List<FoodListBean.DataBeanX.DataBean> dataBeanXList);
    }

    public getFoodList listener;

    public void setListener(getFoodList listener) {
        this.listener = listener;
    }

    public void LoadFoodList(Context context,int type_id,int p,int num){
        Apis.INSTANCE.FoodList(type_id,p,num)
                .subscribe(new BaseObser<Response<FoodListBean>>(context) {
                    @Override
                    public void httpSuccess(Response<FoodListBean> foodListBeanResponse) {
                        if (listener!=null){
                            listener.LoadFoodList(foodListBeanResponse.body().getData().getData());
                        }
                    }
                });
    }
}
